package com.hk.commons.vo;

import com.hk.commons.ResultCode;

import java.io.Serializable;

/**
 * Created by Antinomy on 16/10/13.
 */
public class JsonResult<T> implements Serializable {

    public String resultCode;
    public String msg;
    public Long size = 1l;
    public String ssn = null;
    public T result;

    public static JsonResult renderMsg(ResultCode code, Object data) {
        JsonResult result = new JsonResult();

        result.resultCode = code.getCode();
        result.msg = code.getMsg();
        result.result = data;

        return result;
    }


    public static JsonResult getSucMsg(Object data) {
        return renderMsg(ResultCode.SUCC, data);
    }
}
